<!DOCTYPE html>


  <html class="dark page-post">


<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  
  <title>日常频繁使用的Linux命令 | Poetry&#39;s Blog</title>

  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  
    <meta name="keywords" content="Linux,">
  

  <meta name="description" content="一、文件管理1.1 创建删除文件  mkdir(-p多层创建) touch cp(-r递归复制) rm -rf mv(改名、移动剪切) cat (打印)  1.2 创建删除软连接  linux下的软链接类似于windows下的快捷方式。常用于实际路径很深，每次进入的时候需要花费一定时间，此时我们在根目录创建一个软链接指向该目录，那么我们进入该软连接其实就是进入了软链接指向的实际目录。  ln  -">
<meta name="keywords" content="Linux">
<meta property="og:type" content="article">
<meta property="og:title" content="日常频繁使用的Linux命令">
<meta property="og:url" content="http://blog.poetries.top/2018/02/25/linux-frequently-use-command/index.html">
<meta property="og:site_name" content="Poetry&#39;s Blog">
<meta property="og:description" content="一、文件管理1.1 创建删除文件  mkdir(-p多层创建) touch cp(-r递归复制) rm -rf mv(改名、移动剪切) cat (打印)  1.2 创建删除软连接  linux下的软链接类似于windows下的快捷方式。常用于实际路径很深，每次进入的时候需要花费一定时间，此时我们在根目录创建一个软链接指向该目录，那么我们进入该软连接其实就是进入了软链接指向的实际目录。  ln  -">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2020-08-15T04:25:31.926Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="日常频繁使用的Linux命令">
<meta name="twitter:description" content="一、文件管理1.1 创建删除文件  mkdir(-p多层创建) touch cp(-r递归复制) rm -rf mv(改名、移动剪切) cat (打印)  1.2 创建删除软连接  linux下的软链接类似于windows下的快捷方式。常用于实际路径很深，每次进入的时候需要花费一定时间，此时我们在根目录创建一个软链接指向该目录，那么我们进入该软连接其实就是进入了软链接指向的实际目录。  ln  -">

  

  
    <link rel="icon" href="/favicon.ico">
  

  <link href="/css/styles.css?v=c114cbeddx" rel="stylesheet">
<link href="/css/other.css?v=c114cbeddx" rel="stylesheet">


  
    <link rel="stylesheet" href="/css/personal-style.css">
  

  

  
  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?40b1f89aa80f2527b3db779c6898c879";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>


  
  <script type="text/javascript">
	(function(){
	    var bp = document.createElement('script');
	    var curProtocol = window.location.protocol.split(':')[0];
	    if (curProtocol === 'https') {
	        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
	    }
	    else {
	        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
	    }
	    var s = document.getElementsByTagName("script")[0];
	    s.parentNode.insertBefore(bp, s);
	})();
  </script>



  
    <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <link rel="stylesheet" href="//cdn.bootcss.com/font-awesome/4.3.0/css/font-awesome.min.css">
  

  <!-- 聊天系统 -->
  
    
   <link type="text/css" rel="stylesheet" href="/renxi/default.css">
   <style>
      #modal {
        position: static !important;
      }
      .filter {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        background: #fe5757;
        animation: colorChange 30s ease-in-out infinite;
        animation-fill-mode: both;
        mix-blend-mode: overlay;
      }
  
      @keyframes colorChange {
        0%, 100% {
            opacity: 0;
        }
        50% {
            opacity: .9;
        }
      }
   </style>
</head>
</html>
<body>
  
  
    <span id="toolbox-mobile" class="toolbox-mobile">导航</span>
  

  <div class="post-header CENTER">
   
  <div class="toolbox">
    <a class="toolbox-entry" href="/">
      <span class="toolbox-entry-text">导航</span>
      <i class="icon-angle-down"></i>
      <i class="icon-home"></i>
    </a>
    <ul class="list-toolbox">
      
        <li class="item-toolbox">
          <a
            class="CIRCLE"
            href="/archives/"
            rel="noopener noreferrer"
            target="_self"
            >
            博客
          </a>
        </li>
      
        <li class="item-toolbox">
          <a
            class="CIRCLE"
            href="/categories/"
            rel="noopener noreferrer"
            target="_self"
            >
            分类
          </a>
        </li>
      
        <li class="item-toolbox">
          <a
            class="CIRCLE"
            href="/tags/"
            rel="noopener noreferrer"
            target="_self"
            >
            标签
          </a>
        </li>
      
        <li class="item-toolbox">
          <a
            class="CIRCLE"
            href="/search/"
            rel="noopener noreferrer"
            target="_self"
            >
            搜索
          </a>
        </li>
      
        <li class="item-toolbox">
          <a
            class="CIRCLE"
            href="/link/"
            rel="noopener noreferrer"
            target="_self"
            >
            友链
          </a>
        </li>
      
        <li class="item-toolbox">
          <a
            class="CIRCLE"
            href="/about/"
            rel="noopener noreferrer"
            target="_self"
            >
            关于
          </a>
        </li>
      
    </ul>
  </div>


</div>


  <div id="toc" class="toc-article">
    <strong class="toc-title">文章目录<i class="iconfont toc-title" style="display:inline-block;color:#87998d;width:20px;height:20px;">&#xf004b;</i></strong>
    <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#一、文件管理"><span class="toc-text">一、文件管理</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#二、搜索命令"><span class="toc-text">二、搜索命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#三、压缩解压命令"><span class="toc-text">三、压缩解压命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#四、VI相关"><span class="toc-text">四、VI相关</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#五、磁盘管理"><span class="toc-text">五、磁盘管理</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#六、进程管理"><span class="toc-text">六、进程管理</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#七、网络管理"><span class="toc-text">七、网络管理</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#八、上传文件相关"><span class="toc-text">八、上传文件相关</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#九、系统相关"><span class="toc-text">九、系统相关</span></a></li></ol>
  </div>
  




<div class="content content-post CENTER">
   <!-- canvas 彩带 -->
<canvas id="evanyou" width="1302" height="678" style="position: fixed;width: 100%;height: 100%;top: 0;left:0;z-index:-1;"></canvas>

<article id="post-linux-frequently-use-command" class="article article-type-post" itemprop="blogPost">
  <header class="article-header" style="position:relative;">
    <h1 class="post-title">日常频繁使用的Linux命令</h1>

    <div class="article-meta">
      <span>
        <i class="icon-calendar"></i>
        <span>2018.02.25</span>
      </span>

      
        <span class="article-author">
          <i class="icon-user"></i>
          <span>Poetry</span>
        </span>
      

      
  <span class="article-category">
    <i class="icon-list"></i>
    <a class="article-category-link" href="/categories/Back-end/">Back-end</a>
  </span>



      

      
      <i class="fa fa-eye"></i> 
        <span id="busuanzi_container_page_pv">
           &nbsp热度 <span id="busuanzi_value_page_pv">
           <i class="fa fa-spinner fa-spin"></i></span>℃
        </span>
      
      
       
          <span class="post-count">
            <i class="fa fa-file-word-o"></i>&nbsp
            <span>字数统计 1.6k字</span>
          </span>

          <span class="post-count">
            <i class="fa fa-columns"></i>&nbsp
            <span>阅读时长 6分</span>
          </span>
      
      
    </div>

    <i class="iconfont" id="toc-eye" style="display:inline-block;color:#b36619;position:absolute;top:0;right:0;cursor:pointer;
    font-size: 24px;">&#xe61c;</i>

  </header>

  <div class="article-content">
    
      <div id="container">
        <h2 id="一、文件管理"><a href="#一、文件管理" class="headerlink" title="一、文件管理"></a>一、文件管理</h2><p><strong>1.1 创建删除文件</strong></p>
<ul>
<li><code>mkdir</code>(<code>-p</code>多层创建)</li>
<li><code>touch</code></li>
<li><code>cp</code>(<code>-r</code>递归复制)</li>
<li><code>rm -rf</code></li>
<li><code>mv</code>(改名、移动剪切)</li>
<li><code>cat</code> (打印)</li>
</ul>
<p><strong>1.2 创建删除软连接</strong></p>
<blockquote>
<p>linux下的软链接类似于windows下的快捷方式。常用于实际路径很深，每次进入的时候需要花费一定时间，此时我们在根目录创建一个软链接指向该目录，那么我们进入该软连接其实就是进入了软链接指向的实际目录。</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">ln  -s  /data/elastic/plugin/ik/custom  myES</span><br></pre></td></tr></table></figure>
<ul>
<li>以上命令中的 <code>/data/elastic/plugin/ik/custom</code> 就是源文件，<code>myES</code> 是链接文件名， 其作用是当进入 <code>myES</code> 目录，实际上是链接进入了 <code>/data/elastic/plugin/ik/custom</code> 目录</li>
<li><strong>删除软链接</strong> <code>rm -rf  myES</code> <ul>
<li>注意不是 <code>rm -rf  myES/</code></li>
</ul>
</li>
</ul>
<p><strong>1.3 重定向命令</strong></p>
<ul>
<li><code>ls  -l  /etc &gt; /home/myback.txt</code>     (覆盖重定向)　把显示的结果覆盖到<code>/home/myback.txt</code>中去</li>
<li><code>ls  -l  /etc &gt;&gt; /home/myback.txt</code>     (追加重定向)　把显示的结果追加到<code>/home/myback.txt</code>中去 </li>
</ul>
<p><strong>1.4 查看文件大小</strong></p>
<ul>
<li>查看某个文件夹当前所占用的空间使用 <code>du -h file</code></li>
<li>查看当前目录下的所有文件各个大小 <code>du -sh *</code>  </li>
</ul>
<h2 id="二、搜索命令"><a href="#二、搜索命令" class="headerlink" title="二、搜索命令"></a>二、搜索命令</h2><p><strong>2.1 管道过滤</strong></p>
<ul>
<li>使用管道命令过滤搜索的内容 <code>ls -l /etc | more</code></li>
</ul>
<p><strong>2.2 查询命令</strong>  </p>
<ul>
<li><strong>which</strong></li>
</ul>
<blockquote>
<p>在<code>PATH</code>变量指定的路径中，搜索某个系统命令的位置，并且返回第一个搜索结果</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="comment"># `-a`：将所有由`PATH`目录中可以找到的命令均列出来，而不是只列出第一个被找到的命令</span></span><br><span class="line">[root@www ~] <span class="comment"># which ifconfig</span></span><br><span class="line">/sbin/ifconfig</span><br></pre></td></tr></table></figure>
<ul>
<li><strong>whereis</strong><ul>
<li><code>-b</code> 只查找二进制格式的文件</li>
<li><code>-m</code> 只查找在说明文件manual路径下的文件</li>
<li><code>-s</code> 只招<code>source</code>源文件</li>
<li><code>-u</code> 查找不在上述三个选项当中的其他特殊文件</li>
</ul>
</li>
</ul>
<blockquote>
<p>只能用于程序名的搜索，而且只搜索二进制文件（参数<code>-b</code>）、<code>man</code>说明文件（参数<code>-m</code>）和源代码文件（参数<code>-s</code>）</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">whereis [-bmsu] 文件或目录名</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">[root@www ~] <span class="comment"># whereis ifconfig</span></span><br><span class="line">ifconfig: /sbin/ifconfig /usr/share/man/man8/ifconfig.8.gz</span><br><span class="line">[root@www ~] <span class="comment"># whereis -m ifconfig</span></span><br><span class="line">ifconfig: /usr/share/man/man8/ifconfig.8.gz</span><br></pre></td></tr></table></figure>
<ul>
<li><strong>locate</strong><ul>
<li><code>-i</code>：忽略大小写差异；</li>
<li><code>-r</code>：后面可接正则表达式的实现方式。</li>
</ul>
</li>
</ul>
<blockquote>
<p>相当于<code>find -name</code>，可快速查找文件</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">locate [-ir] keyword</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">[root@www ~] <span class="comment"># locate passwd</span></span><br><span class="line">/etc/passwd</span><br><span class="line">/etc/passwd-</span><br><span class="line">/etc/news/passwd.nntp</span><br><span class="line">/etc/pam.d/passwd</span><br></pre></td></tr></table></figure>
<ul>
<li><strong>find查找任何文件</strong></li>
</ul>
<blockquote>
<p>最常用和最强大的查找命令，可以用它找到任何想找的文件</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">find [PATH] [option] [action]</span><br></pre></td></tr></table></figure>
<p><strong>find参数：基于文件名的搜索</strong></p>
<ul>
<li>与文件名有关的参数如下<ul>
<li><code>-name filename</code>：查找文件名为<code>filename</code>的文件。<code>filename</code>可使用正则表达式表示</li>
</ul>
</li>
</ul>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">[root@www ~] # find / -name passwd</span><br></pre></td></tr></table></figure>
<p>查找文件名为<code>passwd</code>的文件</p>
<p><strong>find参数：基于文件大小的搜索</strong></p>
<ul>
<li>与文件大小有关的参数如下<ul>
<li><code>-size SIZE</code>：查找文件大小刚好等于SIZE的文件</li>
<li><code>-size -SIZE</code>：查找文件大小大于SIZE的文件</li>
<li><code>-size +SIZE</code>：查找文件大小小于SIZE的文件</li>
</ul>
</li>
</ul>
<blockquote>
<p>其中，SIZE的单位有</p>
</blockquote>
<ul>
<li><code>c</code> —— <code>byte</code>，字节；</li>
<li><code>w</code> —— 字（2字节）；</li>
<li><code>b</code> —— <code>bit</code>，块（512字节）；</li>
<li><code>k</code> —— 千字节；</li>
<li><code>M</code> —— 兆字节；</li>
<li><code>G</code> —— 吉字节</li>
</ul>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">[root@www ~] <span class="comment"># find . -type f -size +10k</span></span><br><span class="line">搜索大于10KB的文件</span><br><span class="line">[root@www ~] <span class="comment"># find . -type f -size 10k</span></span><br><span class="line">搜索等于10KB的文件</span><br></pre></td></tr></table></figure>
<p><strong>注意</strong></p>
<ul>
<li>通常<code>find</code>不很常用，因为速度慢！</li>
<li>通常都是先使用<code>whereis</code>或者<code>locate</code>来检查，当真的找不到了，才用<code>find</code>查找</li>
</ul>
<h2 id="三、压缩解压命令"><a href="#三、压缩解压命令" class="headerlink" title="三、压缩解压命令"></a>三、压缩解压命令</h2><ul>
<li><code>*.tar</code> 用 <code>tar -xvf</code> 解压</li>
<li><code>*.gz</code> 用 <code>gzip -d</code>或者<code>gunzip</code> 解压</li>
<li><code>*.tar.gz</code>和<code>*.tgz</code> 用 <code>tar -xzf</code> 解压</li>
<li><code>*.bz2</code> 用<code>bzip2 -d</code>或者用<code>bunzip2</code> 解压</li>
<li><code>*.tar.bz2</code>用<code>tar -xjf</code> 解压</li>
<li><code>*.Z</code> 用 <code>uncompress</code> 解压</li>
<li><code>*.tar.Z</code> 用<code>tar -xZf</code> 解压</li>
<li><code>*.rar</code> 用 <code>unrar e</code>解压</li>
<li><code>*.zip</code> 用 <code>unzip</code> 解压</li>
</ul>
<h2 id="四、VI相关"><a href="#四、VI相关" class="headerlink" title="四、VI相关"></a>四、VI相关</h2><ul>
<li>定位到头尾 <ul>
<li><code>G</code> 定位到尾</li>
<li><code>1G</code> 定位到头</li>
<li><code>nG</code> 定位到指定行</li>
</ul>
</li>
<li>复制<ul>
<li>复制一行 <ul>
<li><code>yy</code> 复制当前行</li>
</ul>
</li>
<li>复制多行<ul>
<li><code>7yy</code> 从当前行开始复制<code>７</code>行</li>
</ul>
</li>
<li>复制当前到行尾的内容 <ul>
<li><code>y$</code></li>
</ul>
</li>
</ul>
</li>
<li>粘贴<ul>
<li><code>p</code> </li>
<li>大写<code>P</code>代表贴至游标前</li>
</ul>
</li>
<li>选择复制<ul>
<li><code>v</code>进入可视化</li>
</ul>
</li>
<li>删除<ul>
<li>删除一行<ul>
<li><code>dd</code></li>
</ul>
</li>
<li>剪切至行首 <ul>
<li><code>d^</code></li>
</ul>
</li>
<li>剪切至行尾 <ul>
<li><code>d$</code></li>
</ul>
</li>
</ul>
</li>
<li>搜索 <code>/</code>搜索的关键字，按<code>n</code>切换下一个关键字</li>
</ul>
<h2 id="五、磁盘管理"><a href="#五、磁盘管理" class="headerlink" title="五、磁盘管理"></a>五、磁盘管理</h2><ul>
<li>查看内存使用情况： <code>free -m</code>  (<code>m</code>为<code>MB</code>，<code>g</code>为<code>GB</code>)</li>
<li>查看对应磁盘使用情况： <code>df -h</code></li>
</ul>
<h2 id="六、进程管理"><a href="#六、进程管理" class="headerlink" title="六、进程管理"></a>六、进程管理</h2><ul>
<li><code>pkill</code>  根据进程名杀死进程</li>
<li><code>ps</code> 列出系统中运行的进程，包括进程号、命令、CPU使用量、内存使用量<ul>
<li><code>ps -a</code> 列出所有运行中/激活进程</li>
<li><code>ps -ef |grep processName</code> 列出需要进程</li>
<li><code>ps -aux</code> 显示进程信息</li>
</ul>
</li>
<li><code>pstree</code> <code>linux</code>中，每一个进程都是由其父进程创建的。此命令以可视化方式显示进程，通过显示进程的树状图来展示进程间关系</li>
<li><code>top</code> <ul>
<li>可以监视系统中不同的进程所使用的资源</li>
<li>显示进程的数据包括<code>PID</code>、进程属主、优先级、<code>%CPU</code>、<code>%memory</code>等。可以使用这些显示指示出资源使用量</li>
</ul>
</li>
</ul>
<h2 id="七、网络管理"><a href="#七、网络管理" class="headerlink" title="七、网络管理"></a>七、网络管理</h2><p><strong>7.1 下载源管理</strong></p>
<ul>
<li><code>yum list | grep nginx</code> 查看是否有<code>Nginx</code>源</li>
</ul>
<p><strong>7.2 防火墙相关</strong></p>
<blockquote>
<p><code>linux</code>查看防火墙状态及开启关闭命令</p>
</blockquote>
<ul>
<li><strong>service方式</strong></li>
</ul>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="comment"># 查看防火墙状态</span></span><br><span class="line"></span><br><span class="line">[root@centos6 ~]<span class="comment"># service iptables status</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 开启防火墙</span></span><br><span class="line"></span><br><span class="line">[root@centos6 ~]<span class="comment"># service iptables start</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 关闭防火墙</span></span><br><span class="line">[root@centos6 ~]<span class="comment"># service iptables stop</span></span><br></pre></td></tr></table></figure>
<p><strong>iptables方式</strong></p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">[root@centos6 ~]<span class="comment"># cd /etc/init.d/</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看状态</span></span><br><span class="line">[root@centos6 init.d]<span class="comment"># /etc/init.d/iptables status</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 暂时关闭防火墙 </span></span><br><span class="line">[root@centos6 init.d]<span class="comment"># /etc/init.d/iptables stop</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># iptables</span></span><br><span class="line">[root@centos6 init.d]<span class="comment"># /etc/init.d/iptables restart</span></span><br></pre></td></tr></table></figure>
<ul>
<li><code>linux</code>的防火墙是否阻止80端口<ul>
<li>返回有内容说明开通，没返回内容，则说明阻止</li>
<li><code>iptables -vnL | grep &quot;:80 &quot;</code></li>
</ul>
</li>
</ul>
<h2 id="八、上传文件相关"><a href="#八、上传文件相关" class="headerlink" title="八、上传文件相关"></a>八、上传文件相关</h2><ul>
<li>从远处复制文件到本地目录 <ul>
<li><code>scp root@10.10.10.10:/opt/soft/nginx-0.5.38.tar.gz /opt/soft/</code></li>
</ul>
</li>
<li>上传本地目录到远程机器指定目录(拷贝目录带上<code>-r</code>,递归复制)<ul>
<li><code>scp -r /opt/soft/mongodb root@10.10.10.10:/opt/soft/scptest</code></li>
</ul>
</li>
</ul>
<h2 id="九、系统相关"><a href="#九、系统相关" class="headerlink" title="九、系统相关"></a>九、系统相关</h2><p><strong>9.1 CPU管理</strong></p>
<ul>
<li>查看对应CPU使用情况<ul>
<li><code>cat /proc/cpuinfo</code></li>
</ul>
</li>
<li>只显示一行对应的CPU型号以及其他信息 <ul>
<li><code>cat  /proc/cpuinfo | grep &quot;model name&quot; | head -1</code></li>
</ul>
</li>
<li>系统有几个核就会显示几行<ul>
<li><code>cat  /proc/cpuinfo | grep &quot;model name&quot;</code></li>
</ul>
</li>
<li>统计出一共有多少核<ul>
<li><code>cat  /proc/cpuinfo | grep &quot;model name&quot; | wc -l</code></li>
</ul>
</li>
</ul>
<p><strong>9.2其他</strong></p>
<ul>
<li>查看对应服务器版本当前操作系统发行版信息<ul>
<li><code>cat /etc/issue</code>  或  <code>cat /etc/redhat-release</code></li>
</ul>
</li>
<li>查看更为底层的版本信息： <code>cat /proc/version</code></li>
</ul>

      </div>
    
  </div>

</article>

<button class="assist-btn2 circle" id="assist_btn2" title="点亮屏幕" style="left: 27px; top: 152px;">
  <i class="iconfont" style="display:inline-block;color:red;width:20px;height:20px;">&#xe61d;</i>
</button>
<button class="assist-btn1 circle" id="assist_btn1" title="关闭屏幕亮度" style="left: 27px; top: 152px;">
  <i class="iconfont toc-title" style="display:inline-block;color:red;width:20px;height:20px;">&#xe61d;</i>
</button>


<script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>	

<script src="https://my.openwrite.cn/js/readmore.js" type="text/javascript"></script>
<script>
  const btw = new BTWPlugin();
  btw.init({
    id: "container",
    blogId: "22699-1592137983091-414",
    name: "前端进阶之旅",
    qrcode: "https://poetries1.gitee.io/img-repo/2020/06/qrcode.jpg",
    keyword: "3a3b3c",
  });
</script>

<script type="text/javascript">

// white theme
var body = {color: "#555", background: "#000"};
var a_tag = {color: "#222"};
var header = { background: "#222"};
var logo_line_i = {background: "#222"};
// var post_code = {background: "#eee", color: "#222"};

function switch_theme() {
 $("body").css(body);
 $("a:not('.links-of-author-item a, .site-state-item a, .site-state-posts a, .feed-link a, .motion-element a, .post-tags a, .show-commit-cls a, #donate_board a')").css(a_tag);
 $(".header, .footer").css(header);
 $(".logo-line-before i, .logo-line-after i").css(logo_line_i);
 //$(".post code").css(post_code);
 $("#idhyt-surprise-ball #idhyt-surprise-ball-animation .drag").css(a_tag);
 $(".post-title-link, .posts-expand .post-meta, .post-comments-count, .disqus-comment-count, .post-category a, .post-nav-next a, .post-nav-item a").css(a_tag);
 
 // $("code").css({color: '#c5c8c6', background: '#1d1f21'});
 //$("#assist_btn1").hide(1500);
}

$(function () {
$("#assist_btn2").css("display","none");
 $("#assist_btn1").click(function() {
     switch_theme();
$("div#toc.toc-article").css({
 "background":"#eaeaea",
 "opacity":1
});
$(".toc-article ol").show();
$("#toc.toc-article .toc-title").css("color","#a98602");
$("#assist_btn1").css("display","none");
$("#assist_btn2").css("display","block");
 });
$("#assist_btn2").click(function() {
$("#assist_btn2").css("display","none");
$("#assist_btn1").css("display","block");
$("body").css("background","url(http://www.miaov.com/static/ie/images/news/bg.png)")
     $(".header, .footer").css("background","url(http://www.miaov.com/static/ie/images/news/bg.png)")
$(".toc-article ol").toggle(1000);
 });
});


//背景随机

var Y, O, E, L, B, C, T, z, N, S, A, I;
!function() {
var e = function() {
for (O.clearRect(0, 0, L, B), T = [{
x: 0,
y: .7 * B + C
}, {
x: 0,
y: .7 * B - C
}]; T[1].x < L + C;) t(T[0], T[1])
}, t = function(e, t) {
O.beginPath(), O.moveTo(e.x, e.y), O.lineTo(t.x, t.y);
var n = t.x + (2 * I() - .25) * C,
 r = a(t.y);
O.lineTo(n, r), O.closePath(), N -= S / -50, O.fillStyle = "#" + (127 * A(N) + 128 << 16 | 127 * A(N + S / 3) + 128 << 8 | 127 * A(N + S / 3 * 2) + 128).toString(16), O.fill(), T[0] = T[1], T[1] = {
 x: n,
 y: r
}
}, a = function n(e) {
var t = e + (2 * I() - 1.1) * C;
return t > B || t < 0 ? n(e) : t
};
Y = document.getElementById("evanyou"), O = Y.getContext("2d"), E = window.devicePixelRatio || 1, L = window.innerWidth, B = window.innerHeight, C = 90, z = Math, N = 0, S = 2 * z.PI, A = z.cos, I = z.random, Y.width = L * E, Y.height = B * E, O.scale(E, E), O.globalAlpha = .6, document.onclick = e, document.ontouchstart = e, e()
}()

   
$("#toc-eye").click(function(){
$("#toc.toc-article").toggle(1000);
});

</script>


   
  <div class="text-center donation">
    <div class="inner-donation">
      <span class="btn-donation">支持一下</span>
      <div class="donation-body">
        <div class="tip text-center">扫一扫，支持poetries</div>
        <ul>
        
          <li class="item">
            
              <span>微信扫一扫</span>
            
            <img src="/images/weixin.jpg" alt="">
          </li>
        
          <li class="item">
            
              <span>支付宝扫一扫</span>
            
            <img src="/images/zhifubao.jpg" alt="">
          </li>
        
        </ul>
      </div>
    </div>
  </div>


   
  <div class="box-prev-next clearfix">
    <a class="show pull-left" href="/2018/02/23/js-string-arr-object-api/">
        <i class="icon icon-angle-left"></i>
    </a>
    <a class="show pull-right" href="/2018/02/25/nginx-study/">
        <i class="icon icon-angle-right"></i>
    </a>
  </div>




</div>


  <a id="backTop" class="back-top">
    <i class="icon-angle-up"></i>
  </a>




  <div class="modal" id="modal">
  <span id="cover" class="cover hide"></span>
  <div id="modal-dialog" class="modal-dialog hide-dialog">
    <div class="modal-header">
      <span id="close" class="btn-close">关闭</span>
    </div>
    <hr>
    <div class="modal-body">
      <ul class="list-toolbox">
        
          <li class="item-toolbox">
            <a
              class="CIRCLE"
              href="/archives/"
              rel="noopener noreferrer"
              target="_self"
              >
              博客
            </a>
          </li>
        
          <li class="item-toolbox">
            <a
              class="CIRCLE"
              href="/categories/"
              rel="noopener noreferrer"
              target="_self"
              >
              分类
            </a>
          </li>
        
          <li class="item-toolbox">
            <a
              class="CIRCLE"
              href="/tags/"
              rel="noopener noreferrer"
              target="_self"
              >
              标签
            </a>
          </li>
        
          <li class="item-toolbox">
            <a
              class="CIRCLE"
              href="/search/"
              rel="noopener noreferrer"
              target="_self"
              >
              搜索
            </a>
          </li>
        
          <li class="item-toolbox">
            <a
              class="CIRCLE"
              href="/link/"
              rel="noopener noreferrer"
              target="_self"
              >
              友链
            </a>
          </li>
        
          <li class="item-toolbox">
            <a
              class="CIRCLE"
              href="/about/"
              rel="noopener noreferrer"
              target="_self"
              >
              关于
            </a>
          </li>
        
      </ul>

    </div>
  </div>
</div>



  
      <div class="fexo-comments comments-post">
    

    

    
    

    

    
    

    

<!-- Gitalk评论插件通用代码 -->
<div id="gitalk-container"></div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
<script>
const gitalk = new Gitalk({
  clientID: '5567a2c4abb858009d96',
  clientSecret: 'b9039ec056cf5c2346b3cdb63308a28c163f91e5',
  repo: 'poetries.github.io',
  owner: 'poetries',
  // 在这里设置一下截取前50个字符串, 这是因为 github 对 label 的长度有了要求, 如果超过
  // 50个字符串则会报错.
  // id: location.pathname.split('/').pop().substring(0, 49),
  id: location.pathname,
  admin: ['poetries'],
  // facebook-like distraction free mode
  distractionFreeMode: false
})
gitalk.render('gitalk-container')
</script>
<!-- Gitalk代码结束 -->



  </div>

  

  <script type="text/javascript">
  function loadScript(url, callback) {
    var script = document.createElement('script')
    script.type = 'text/javascript';

    if (script.readyState) { //IE
      script.onreadystatechange = function() {
        if (script.readyState == 'loaded' ||
          script.readyState == 'complete') {
          script.onreadystatechange = null;
          callback();
        }
      };
    } else { //Others
      script.onload = function() {
        callback();
      };
    }

    script.src = url;
    document.getElementsByTagName('head')[0].appendChild(script);
  }

  window.onload = function() {
    loadScript('/js/bundle.js?235683', function() {
      // load success
    });
  }
</script>


  <!-- 页面点击小红心 -->
  <script type="text/javascript" src="/js/clicklove.js"></script>
 
  
</body>
</html>
